import { defineStore } from "pinia";
import { getList } from '../server/index'
import type { RootObject,Children,ChinaAdd,ChinaTotal,StatisGradeCityDetail } from './type'



export const useStore = defineStore(
  "lky",
  {
    state: () => ({
      list: <RootObject>{},
      children: <Children[]>[],
      chinaAdd: <ChinaAdd>{},
      chinaTotal: <ChinaTotal>{},
      cityDetail:<StatisGradeCityDetail[]>[]
    }),
    actions: {
      async getApiList() {
        const result = await getList()
        this.list = result
        this.chinaAdd = result.diseaseh5Shelf.chinaAdd;
        this.chinaTotal = result.diseaseh5Shelf.chinaTotal
        // console.log(result.statisGradeCityDetail.slice(0,10));
        
        this.cityDetail=result.statisGradeCityDetail.slice(0,10)

      }
    }
  }
);
